<template>
  <div>
    <el-row :gutter="15">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"
               label-position="top">
<!--        <el-input type="hidden" v-model="formData.orgId"></el-input>-->

        <el-col :span="12">
          <el-form-item label="组织Id">
            <el-input v-model="formData.orgId" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="姓名" prop="applyName">
            <el-input v-model="formData.applyName" placeholder="请输入姓名" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="学号" prop="applyStuid">
            <el-input v-model="formData.applyStuid" placeholder="请输入学号" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="系部" prop="applyDept">
            <el-input v-model="formData.applyDept" placeholder="请输入系部" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="专业" prop="applyProf">
            <el-input v-model="formData.applyProf" placeholder="请输入专业" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="手机号" prop="applyPhone">
            <el-input v-model="formData.applyPhone" placeholder="请输入手机号" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="QQ号" prop="applyQrcode">
            <el-input v-model="formData.applyQrcode" placeholder="请输入QQ号" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="第一志愿" prop="applyFirst">
            <el-input v-model="formData.applyFirst" placeholder="请输入第一志愿" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="第二志愿" prop="applySecond">
            <el-input v-model="formData.applySecond" placeholder="请输入第二志愿" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否服从调剂" prop="applyAdjust">
            <el-radio-group v-model="formData.applyAdjust" size="medium">
              <el-radio v-for="(item, index) in adjustOptions" :key="index" :label="item.value"
                        :disabled="item.disabled">{{item.label}}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="个人特长" prop="applySpecialty">
            <el-input v-model="formData.applySpecialty" type="textarea" placeholder="请输入个人特长"
                      :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="岗位相关工作经历" prop="applyWorkexperience">
            <el-input v-model="formData.applyWorkexperience" type="textarea" placeholder="请输入岗位相关工作经历"
                      :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="个人荣誉" prop="applyHonor">
            <el-input v-model="formData.applyHonor" type="textarea" placeholder="请输入个人荣誉"
                      :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="其他说明" prop="applyOther">
            <el-input v-model="formData.applyOther" type="textarea" placeholder="请输入其他说明"
                      :autosize="{minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item size="large">
            <el-button type="primary" @click="submitForm">提交</el-button>
            <el-button @click="resetForm">重置</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>

</template>
<script>

  import { stuApply } from "@/api/hd/recruit";


  export default {

    data() {
      return {
        formData: {
          orgId:'',
          applyName:'',
          applyStuid:'',
          applyDept:'',
          applyProf:'',
          applyPhone:'',
          applyQrcode:'',
          applyFirst:'',
          applySecond:'',
          applyAdjust:1,
          applySpecialty:'',
          applyWorkexperience:'',
          applyHonor:'',
          applyOther:''
        },
        rules: {
          applyName: [{
            required: true,
            message: '请输入姓名',
            trigger: 'blur'
          }],
          applyStuid: [{
            required: true,
            message: '请输入学号',
            trigger: 'blur'
          }],
          applyDept: [{
            required: true,
            message: '请输入系部',
            trigger: 'blur'
          }],
          applyProf: [{
            required: true,
            message: '请输入专业',
            trigger: 'blur'
          }],
          applyPhone: [{
            required: true,
            message: '请输入手机号',
            trigger: 'blur'
          }],
          applyQrcode: [{
            required: true,
            message: '请输入QQ号',
            trigger: 'blur'
          }],
          applyFirst: [{
            required: true,
            message: '请输入第一志愿',
            trigger: 'blur'
          }],
          applySecond: [{
            required: true,
            message: '请输入第二志愿',
            trigger: 'blur'
          }],
          applyAdjust: [{
            required: true,
            message: '是否服从调剂不能为空',
            trigger: 'change'
          }],
          applySpecialty: [{
            required: true,
            message: '请输入个人特长',
            trigger: 'blur'
          }],
          applyWorkexperience: [{
            required: true,
            message: '请输入岗位相关工作经历',
            trigger: 'blur'
          }],
          applyHonor: [{
            required: true,
            message: '请输入个人荣誉',
            trigger: 'blur'
          }],
          applyOther: [{
            required: true,
            message: '请输入其他说明',
            trigger: 'blur'
          }],
        },
        adjustOptions: [{
          "label": "是",
          "value": 1
        }, {
          "label": "否",
          "value": 2
        }],
      }
    },
    computed: {},
    watch: {},
    created() {

    },
    mounted() {
      this.formData.orgId = this.$route.query.orgId;

      console.log("orgId:"+orgId)
    },
    methods: {
      submitForm() {
        this.$refs['elForm'].validate(valid => {
          if (valid) {
            stuApply(this.formData).then(response => {
              console.log(response);

              this.$modal.msgSuccess("提交成功");

              this.$router.push('/table/apply');
            });
          }
        })
      },
      resetForm() {
        this.$refs['elForm'].resetFields()
      }
    }
  }

</script>




